package com.jerry.alibaba.transaction.service;

import com.jerry.alibaba.transaction.entity.Account;
import com.jerry.alibaba.transaction.entity.CommonResult;
import com.jerry.alibaba.transaction.entity.Storage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

@Component
@FeignClient(value = "service-account")
public interface AccountFeignService {

    @PostMapping("/account/create")
    CommonResult create(Account account);

    @GetMapping("/account/get/{id}")
    CommonResult getById(@PathVariable("id") Long id);

    @GetMapping("/account/get")
    CommonResult getList();

    @PostMapping("/account/decrease")
    CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money);

}
